import joblib

import pandas as pd
from matplotlib import pyplot as plt
from sklearn.metrics import roc_auc_score, roc_curve,auc
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from xgboost import XGBRegressor, XGBClassifier
from lightgbm import LGBMClassifier

data= pd.read_csv('../../data/raw/train.csv')
data['Age']=pd.cut(data['Age'],bins=[17,25,35,45,60],labels=[0,1,2,3])
data['DistanceFromHome']=pd.cut(data['DistanceFromHome'],bins=[0,3,5,10,15,20,30],labels=[0,1,2,3,4,5])
data['MonthlyIncome']=pd.cut(data['MonthlyIncome'],bins=[1000,2000,5000,8000,10000,15000,20000],labels=[0,1,2,3,4,5])
data['PercentSalaryHike']=pd.qcut(data['PercentSalaryHike'],3,labels=[0,1,2])
data['TotalWorkingYears']=pd.cut(data['TotalWorkingYears'],bins=[-1,1,2,5,10,20,30,40],labels=[0,1,2,3,4,5,6])
data['YearsAtCompany']=pd.cut(data['YearsAtCompany'],bins=[-1,1,2,5,10,20,30,40],labels=[0,1,2,3,4,5,6])
data['YearsInCurrentRole']=pd.cut(data['YearsInCurrentRole'],bins=[-1,1,2,5,10,18],labels=[0,1,2,3,4])
data['YearsSinceLastPromotion']=pd.cut(data['YearsSinceLastPromotion'],bins=[-1,1,2,5,10,18],labels=[0,1,2,3,5])
data['YearsWithCurrManager']=pd.cut(data['YearsWithCurrManager'],bins=[-1,1,3,5,8,12,17],labels=[0,1,2,3,4,5])
categorical_cols = data.select_dtypes(include=['object']).columns #.tolist()

le = LabelEncoder()
for i in categorical_cols:
    data[i]=le.fit_transform(data[i])
print(type(data['YearsWithCurrManager']))